/**
 * 
 */
package com.fox.webapp.web;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fox.webapp.service.IAccountService;

/**
 * @author yockii
 *
 */
@Controller
@RequestMapping("data")
public class CommissionDataReceiverController {
	
	private static final Logger logger = LoggerFactory.getLogger(CommissionDataReceiverController.class);
	@Autowired
	private IAccountService accountService;

	@RequestMapping(value = "ea", method = RequestMethod.GET)
	@ResponseBody
	public int doit(String brokerName, String accountNo, Double commission, Long inTime){
		
		
		Date time = new Date(inTime * 1000);
		
		logger.debug(accountNo + "   " + commission + "    " + time);
		
		return accountService.addCommission(brokerName, accountNo, commission * 0.95, time);
	}
}
